** Replication for aid-trust paper

* Figure 1. Surveyed Households, All Faultlines, and Earthquake Epicenter

* The underlying GIS data for this image is not available for general public release.
*
*	use "$directory/Data/GIS/studydbf.dta", clear
*		
*	spmap using "$directory/Data/GIS/study.dta", id(id) $graph_opts fc(gs12) oc(gs12) ///
*		point( data("$directory/Data/GIS/households.dta") x(hh_gps_east) y(hh_gps_north) by(hh_stats_permhouse_post) ///
*			legenda(off) legc fcolor(black black black) shape(x x T) prop(size) size(small) osize(thin thin medthick) ) ///
*		line( data("$directory/Data/GIS/study_faults_clipped.dta") by(active) color(black black) pattern(dot dash) size(thin thick))
*	
*		graph export "$directory/figures/Figure 1.png", replace width(3000)
*		graph save "$directory/temp/Figure1.gph", replace 
*		graph export "$directory/figures/pdf/Figure 1.pdf", replace 

* Figure 2. Death and Destruction during the Earthquake

	use "$directory/data/analysis.dta", clear

	qui su c_home_dam if tag_hh == 1
	
	tw  (histogram hh_faultdist, yaxis(2) color(gs14) ) ///
		(lpoly c_home_dam hh_faultdist, lc(black) lw(medthick) yaxis(1) astyle(ci)) ///
		if hh_faultdist < 60 & tag_hh == 1 ///
	,	$graph_opts $hist_opts ylab($xpct) xtit("") /// 
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") ///
		legend(off) subtitle("Home Damaged or Destroyed (N = `r(N)')", pos(12))
	
		graph save "$directory/temp/Figure2_damage.gph", replace
		
	qui su c_home_des if tag_hh == 1

	tw  (histogram hh_faultdist, yaxis(2) color(gs14) ) ///
		(lpoly c_home_des hh_faultdist, lc(black) lw(medthick) yaxis(1) astyle(ci)) ///
		if hh_faultdist < 60 & tag_hh == 1 ///
	,	$graph_opts $hist_opts ylab($xpct) xtit("") /// 
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") ///
		legend(off) subtitle("Home Destroyed (N = `r(N)')", pos(12))
	
		graph save "$directory/temp/Figure2_destroy.gph", replace
		
	qui su indiv_dead_quake if indiv_age > 3
		
	tw  (histogram hh_faultdist, yaxis(2) color(gs14) ) ///
		(lpoly indiv_dead_quake hh_faultdist, lc(black) lw(medthick) yaxis(1) astyle(ci)) ///
		if hh_faultdist < 60 & indiv_age > 3 ///
	,	$graph_opts $hist_opts ylab(0 "0%" .01 "1%" .02 "2%" .03 "3%" .04 "4%" .05 "5%" .06 "6%") ///
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") xtit("") /// 
		subtitle("Died During Earthquake (N = `r(N)')", pos(12)) 	legend(off)
		
		graph save "$directory/temp/Figure2_death.gph", replace
		
	qui su vil_facil_destroyed if tag_village == 1 
	
	tw  (histogram vil_uc_dfl_mean, yaxis(2) color(gs14) ) ///
		(lpoly vil_facil_destroyed hh_faultdist, lc(black) lw(medthick) yaxis(1) astyle(ci)) ///
		if tag_village == 1 & vil_uc_dfl_mean < 60 ///
	,	$graph_opts $hist_opts ylab($xpct) xtit("") /// 
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") ///
		legend(off) subtitle("Village Facilities Destruction (N = `r(N)')", pos(12))
	
		graph save "$directory/temp/Figure2_infra.gph", replace
		
		
	* Combine
		
		graph combine ///
			"$directory/temp/Figure2_damage.gph" ///
			"$directory/temp/Figure2_destroy.gph" ///
			"$directory/temp/Figure2_death.gph" ///
			"$directory/temp/Figure2_infra.gph" ///
		, $comb_opts
	
		graph export "$directory/figures/Figure 2.png", replace width(3000)
		graph export "$directory/figures/pdf/Figure 2.pdf", replace 
		
	
* Figure 3. Aid Response After the Earthquake

	use "$directory/data/analysis.dta", clear

	tw  (histogram hh_faultdist				, yaxis(2) color(gs14) ) ///
		(lpoly c_aid_org_1 hh_faultdist	, lc(black) lp(solid) lw(medthick) yaxis(1) astyle(ci)) ///
		if hh_faultdist < 60 & tag_hh == 1 ///
	,	$graph_opts $hist_opts ylab($xpct) xtit("") /// 
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") ///
		legend(off) subtitle("Army Aid", pos(12))
	
		graph save "$directory/temp/Figure3_army.gph", replace
		
	tw  (histogram hh_faultdist				, yaxis(2) color(gs14) ) ///
		(lpoly c_aid_org_14 hh_faultdist	, lc(black) lp(solid) lw(medthick) yaxis(1) astyle(ci)) ///
		if hh_faultdist < 60 & tag_hh == 1 ///
	,	$graph_opts $hist_opts ylab($xpct) xtit("") /// 
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") ///
		legend(off) subtitle("No Aid", pos(12))
	
		graph save "$directory/temp/Figure3_none.gph", replace
		
	tw  (histogram hh_faultdist				, yaxis(2) color(gs14) ) ///
		(lpoly c_aid_org_10 hh_faultdist	, lc(black) lp(solid) lw(medthick) yaxis(1) astyle(ci)) ///
		if hh_faultdist < 60 & tag_hh == 1 ///
	,	$graph_opts $hist_opts ylab($xpct) xtit("") /// 
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") ///
		legend(off) subtitle("Western Aid", pos(12))
	
		graph save "$directory/temp/Figure3_western.gph", replace
	
	tw  (histogram hh_faultdist				, yaxis(2) color(gs14) ) ///
		(lpoly c_aid_org_22 hh_faultdist	, lc(black) lp(solid) lw(medthick) yaxis(1) astyle(ci)) ///
		if hh_faultdist < 60 & tag_hh == 1 ///
	,	$graph_opts $hist_opts ylab($xpct) xtit("") /// 
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") ///
		legend(off) subtitle("Other Aid", pos(12))
	
		graph save "$directory/temp/Figure3_other.gph", replace
		
	
	graph combine ///
		"$directory/temp/Figure3_western.gph" ///
		"$directory/temp/Figure3_army.gph" ///
		"$directory/temp/Figure3_other.gph" ///
		"$directory/temp/Figure3_none.gph" ///
	, $comb_opts xcom ycom
		
	graph export "$directory/figures/Figure 3.png", replace width(3000)
	graph export "$directory/figures/pdf/Figure 3.pdf", replace 
	
	
* Figure 4. Aid and Trust in Outsiders after the Earthquake

	use "$directory/data/analysis.dta", clear
	
	tw 	(histogram hh_faultdist	if indiv_trust_note_h !=.	, yaxis(2) color(gs14) ) ///
		(lpoly c_aid_org_10 hh_faultdist if tag_hh ==1		, lc(black) lp(solid) lw(medthick) ) ///
		(lpoly indiv_trust_note_g hh_faultdist	if touse_trust == 1			, lc(black) lp(#__) lw(medthick) ) ///
		(lpoly indiv_trust_note_h hh_faultdist	if touse_trust == 1			, lc(black) lp(dash) lw(medthick) yaxis(1)) ///
		(lpoly indiv_trust_note_e hh_faultdist	if touse_trust == 1			, lc(black) lp(dash_dot) lw(medthick) yaxis(1)) ///
		if hh_faultdist < 60  ///
	, 	$graph_opts $hist_opts ylab($xpct) xtit("") /// 
		xlab(0 `""0km" "                              Distance to Activated Faultline {&rarr}""' 20 "20km" 40 "40km" 60 "60km") ///
		legend(pos(2) ring(0) order(4 "Trust ��Westerners" 3 "Trust ��Foreigners in General" 5 "Trust ��Own Region" 2 "Households Reporting Western Aid" ) c(1))
	
		graph export "$directory/figures/Figure 4.png", replace width(3000)
		graph export "$directory/figures/pdf/Figure 4.pdf", replace 
		

* Have a lovely day!
	
